#!/usr/bin/python
# -*- coding: UTF-8 -*-
from kptest.config.enum import HostType

from extension.test_logic.DpuLogic import DpuLogic


class DPU2_FUNCTION_056(DpuLogic):
    """
        Name:
            DPU2_FUNCTION_056
        Label:
           修改boot order
        PreCondition:

        TestStep:
            soc系统/远程机可以通过带内/外修改启动项
            带内命令：
            获取当前启动项设置：ipmitool chassis bootparam get 5
            设置pxe启动：ipmitool chassis bootparam set bootflag force_pxe
            设置默认启动项：ipmitool chassis bootparam set bootflag none
        ExpectedResult:
            A) soc系统/远程机可以通过带内/外修改启动项
        Parameters:

        Author:
            HK1342
        Last Modified:
            2025/05/22
        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        super().pre_test_case()

    # 测试步骤
    def procedure(self):
        self.log_step("Step1: 带外修改SOC系统启动项")
        self.set_dpu_boot_flag(boot_flag="force_pxe")

        self.log_step("Step2: 带外修改SOC系统默认启动项")
        self.set_dpu_boot_flag(boot_flag="none")

        self.log_step("Step3: 带外查询SOC系统启动项")
        boot_dev = self.get_dpu_boot_flag()
        self.assertEqual(boot_dev, "force_pxe", "boot_dev is not force_pxe")
        default_boot_dev = self.get_dpu_boot_flag()
        self.assertEqual(default_boot_dev, "none", "boot_dev is not none")

    # 测试结束后恢复环境
    def post_test_case(self):
        pass
